addpath(genpath("/Users/bknapp/Documents/FRAP_Data/analysis_scripts/"));
dirname = "/Users/bknapp/Documents/FRAP_Data/20221103_mitotracker_FRAP/BW25113_LB_37C/imagej_outputs/";
filewc = "*.tif";
tif_filelist = dir(strcat(dirname, filewc));

FRAP_struct = struct();

for k=1:length(tif_filelist)
    
    % Create root name for all loaded data files
    fname_tif = tif_filelist(k).name;
    fname_root = string(fname_tif(1:end-11));
    
    % Load timestamp vector recorded by Zeiss LSM
    fname_timestamp = strcat(dirname,fname_root,"timestamp.txt");
    timestamp = FRAP_lsm_load_timestamp(fname_timestamp);
    
    % Load ROI bleached cap fluorescence data
    fname_bleached_cap = strcat(dirname,fname_root,"cropped_ROI_cap.csv");
    [area_cap, fluor_tot_cap] = FRAP_lsm_load_fluor_data(fname_bleached_cap);
    
    % Load ROI total cell fluorescence data
    fname_cell = strcat(dirname,fname_root,"cropped_ROI_cell.csv");
    [area_cell, fluor_tot_cell] = FRAP_lsm_load_fluor_data(fname_cell);
    
    % Load ROI bleached cap geometry (LSM outputs units of microns (um))
    fname_cap_dimensions = strcat(dirname,fname_root,"cropped_ROI_cap_dimensions.csv");
    [cap_diameter, cap_length] = FRAP_lsm_load_cap_dimensions(fname_cap_dimensions);
    
    % Write data into structure
    FRAP_struct(k).imagefilename = fname_tif;
    FRAP_struct(k).timestamp = timestamp;
    FRAP_struct(k).cap_area = area_cap;
    FRAP_struct(k).cap_fluor_tot = fluor_tot_cap;
    FRAP_struct(k).cap_diameter = cap_diameter;
    FRAP_struct(k).cap_length = cap_length;
    FRAP_struct(k).cell_area = area_cell;
    FRAP_struct(k).cell_fluor_tot = fluor_tot_cell;
    
end